package com.jisuan.contract.controller;

import com.jisuan.contract.common.utils.PageUtils;
import com.jisuan.contract.common.utils.R;
import com.jisuan.contract.entity.ScSysUserEntity;
import com.jisuan.contract.service.ScSysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 系统登录用户表
 *
 * @author 王大军
 * @email wangdajunzy@163.com
 * @date 2022-01-07 12:05:38
 */
@RestController
@RequestMapping("contract/scsysuser")
public class ScSysUserController {
    @Autowired
    private ScSysUserService scSysUserService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("contract:scsysuser:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = scSysUserService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("contract:scsysuser:info")
    public R info(@PathVariable("id") Long id){
		ScSysUserEntity scSysUser = scSysUserService.getById(id);

        return R.ok().put("scSysUser", scSysUser);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("contract:scsysuser:save")
    public R save(@RequestBody ScSysUserEntity scSysUser){
		scSysUserService.save(scSysUser);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("contract:scsysuser:update")
    public R update(@RequestBody ScSysUserEntity scSysUser){
		scSysUserService.updateById(scSysUser);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("contract:scsysuser:delete")
    public R delete(@RequestBody Long[] ids){
		scSysUserService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
